home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / filutil / flex247x.zip / FLEX247 / FLEX.MAN < prev    next >
Text File  |  1994-09-29  |  41KB  |  859 lines

  1.  
  2.  
  3.  
  4. FLEX(1)                   User Commands                   FLEX(1)
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      flex - fast lexical analyzer generator
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      fffflllleeeexxxx [[[[----bbbbccccddddffffhhhhiiiillllnnnnppppssssttttvvvvwwwwBBBBFFFFIIIILLLLTTTTVVVV77778888++++ ----CCCC[[[[aaaaeeeeffffFFFFmmmmrrrr]]]] ----PPPPpppprrrreeeeffffiiiixxxx  ---- SSSSsssskkkkeeeelllleeee----
  13.      ttttoooonnnn]]]] [_f_i_l_e_n_a_m_e ...]
  14.  
  15. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  16.      _f_l_e_x is a  tool  for  generating  _s_c_a_n_n_e_r_s:  programs  which
  17.      recognized  lexical  patterns in text.  _f_l_e_x reads the given
  18.      input files, or its standard input  if  no  file  names  are
  19.      given,  for  a  description  of  a scanner to generate.  The
  20.      description is in the form of pairs of  regular  expressions
  21.      and  C  code,  called  _r_u_l_e_s.  _f_l_e_x  generates as output a C
  22.      source file, lllleeeexxxx....yyyyyyyy....cccc,,,, which defines a routine yyyyyyyylllleeeexxxx(((()))).... This
  23.      file is compiled and linked with the ----llllffffllll library to produce
  24.      an executable.  When the executable is run, it analyzes  its
  25.      input  for occurrences of the regular expressions.  Whenever
  26.      it finds one, it executes the corresponding C code.
  27.  
  28.      For full documentation, see fffflllleeeexxxxddddoooocccc((((1111)))).... This manual entry is
  29.      intended for use as a quick reference.
  30.  
  31. OOOOPPPPTTTTIIIIOOOONNNNSSSS
  32.      _f_l_e_x has the following options:
  33.  
  34.      ----bbbb    generate backing-up information to _l_e_x._b_a_c_k_u_p. This is
  35.           a  list  of scanner states which require backing up and
  36.           the input characters on which they do  so.   By  adding
  37.           rules   one  can  remove  backing-up  states.   If  all
  38.           backing-up states are eliminated and ----CCCCffff  or   ---- CCCCFFFF  is
  39.           used, the generated scanner will run faster.
  40.  
  41.      ----cccc    is a do-nothing, deprecated option included for  POSIX
  42.           compliance.
  43.  
  44.           NNNNOOOOTTTTEEEE:::: in previous releases of _f_l_e_x ----cccc specified  table-
  45.           compression  options.   This functionality is now given
  46.           by the ----CCCC flag.  To ease the the impact of this change,
  47.           when  _f_l_e_x encounters ----cccc,,,, it currently issues a warning
  48.           message and assumes that ----CCCC was  desired  instead.   In
  49.           the future this "promotion" of ----cccc to ----CCCC will go away in
  50.           the name of full POSIX  compliance  (unless  the  POSIX
  51.           meaning is removed first).
  52.  
  53.      ----dddd    makes the generated scanner run in _d_e_b_u_g mode.   When-
  54.           ever   a   pattern   is   recognized   and  the  global
  55.           yyyyyyyy____fffflllleeeexxxx____ddddeeeebbbbuuuugggg is non-zero (which is the  default),  the
  56.           scanner will write to _s_t_d_e_r_r a line of the form:
  57.  
  58.               --accepting rule at line 53 ("the matched text")
  59.  
  60.  
  61.  
  62.  
  63. Version 2.4        Last change: November 1993                   1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. FLEX(1)                   User Commands                   FLEX(1)
  71.  
  72.  
  73.  
  74.           The line number refers to the location of the  rule  in
  75.           the  file defining the scanner (i.e., the file that was
  76.           fed to flex).  Messages are  also  generated  when  the
  77.           scanner backs up, accepts the default rule, reaches the
  78.           end of its input buffer (or encounters a NUL;  the  two
  79.           look  the  same  as far as the scanner's concerned), or
  80.           reaches an end-of-file.
  81.  
  82.      ----ffff    specifies _f_a_s_t _s_c_a_n_n_e_r. No table compression  is  done
  83.           and  stdio  is bypassed.  The result is large but fast.
  84.           This option is equivalent to ----CCCCffffrrrr (see below).
  85.  
  86.      ----hhhh    generates a "help" summary of _f_l_e_x'_s options to _s_t_d_e_r_r
  87.           and then exits.
  88.  
  89.      ----iiii    instructs _f_l_e_x to generate a _c_a_s_e-_i_n_s_e_n_s_i_t_i_v_e scanner.
  90.           The  case  of  letters given in the _f_l_e_x input patterns
  91.           will be ignored,  and  tokens  in  the  input  will  be
  92.           matched  regardless of case.  The matched text given in
  93.           _y_y_t_e_x_t will have the preserved case (i.e., it will  not
  94.           be folded).
  95.  
  96.      ----llll    turns on maximum compatibility with the original  AT&T
  97.           lex implementation, at a considerable performance cost.
  98.           This option is incompatible with ----++++,,,, ----ffff,,,, ----FFFF,,,, ----CCCCffff,,,, or  ----
  99.           CCCCFFFF.... See _f_l_e_x_d_o_c(_1) for details.
  100.  
  101.      ----nnnn    is another do-nothing, deprecated option included only
  102.           for POSIX compliance.
  103.  
  104.      ----pppp    generates a performance report to stderr.  The  report
  105.           consists  of  comments  regarding  features of the _f_l_e_x
  106.           input file which will cause a loss  of  performance  in
  107.           the resulting scanner.  If you give the flag twice, you
  108.           will also get comments regarding features that lead  to
  109.           minor performance losses.
  110.  
  111.      ----ssss    causes the _d_e_f_a_u_l_t _r_u_l_e (that unmatched scanner  input
  112.           is  echoed to _s_t_d_o_u_t) to be suppressed.  If the scanner
  113.           encounters input that does not match any of its  rules,
  114.           it aborts with an error.
  115.  
  116.      ----tttt    instructs _f_l_e_x to write the scanner  it  generates  to
  117.           standard output instead of lllleeeexxxx....yyyyyyyy....cccc....
  118.  
  119.      ----vvvv    specifies that _f_l_e_x should write to _s_t_d_e_r_r  a  summary
  120.           of statistics regarding the scanner it generates.
  121.  
  122.      ----wwww    suppresses warning messages.
  123.  
  124.      ----BBBB    instructs _f_l_e_x to generate a _b_a_t_c_h scanner instead  of
  125.           an  _i_n_t_e_r_a_c_t_i_v_e scanner (see ----IIII below).  See _f_l_e_x_d_o_c(_1)
  126.  
  127.  
  128.  
  129. Version 2.4        Last change: November 1993                   2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. FLEX(1)                   User Commands                   FLEX(1)
  137.  
  138.  
  139.  
  140.           for details.  Scanners using ----CCCCffff or   ---- CCCCFFFF  compression
  141.           options automatically specify this option, too.
  142.  
  143.      ----FFFF    specifies that the _f_a_s_t scanner  table  representation
  144.           should  be used (and stdio bypassed).  This representa-
  145.           tion is about as fast as the full table  representation
  146.           ((((----ffff)))),,,,  and  for some sets of patterns will be consider-
  147.           ably smaller (and for others, larger).   It  cannot  be
  148.           used  with  the   ---- ++++  option.  See fffflllleeeexxxxddddoooocccc((((1111)))) for more
  149.           details.
  150.  
  151.           This option is equivalent to ----CCCCFFFFrrrr (see below).
  152.  
  153.      ----IIII    instructs _f_l_e_x to  generate  an  _i_n_t_e_r_a_c_t_i_v_e  scanner,
  154.           that  is, a scanner which stops immediately rather than
  155.           looking ahead if it knows that  the  currently  scanned
  156.           text  cannot be part of a longer rule's match.  This is
  157.           the opposite of _b_a_t_c_h scanners (see  ---- BBBB  above).   See
  158.           fffflllleeeexxxxddddoooocccc((((1111)))) for details.
  159.  
  160.           Note, ----IIII cannot be used in  conjunction  with  _f_u_l_l  or
  161.           _f_a_s_t  _t_a_b_l_e_s, i.e., the ----ffff,,,, ----FFFF,,,, ----CCCCffff,,,, or ----CCCCFFFF flags.  For
  162.           other table compression options, ----IIII is the default.
  163.  
  164.      ----LLLL    instructs _f_l_e_x not to  generate  ####lllliiiinnnneeee  directives  in
  165.           lllleeeexxxx....yyyyyyyy....cccc.... The default is to generate such directives so
  166.           error messages in the actions will be correctly located
  167.           with  respect  to the original _f_l_e_x input file, and not
  168.           to the fairly meaningless line numbers of lllleeeexxxx....yyyyyyyy....cccc....
  169.  
  170.      ----TTTT    makes _f_l_e_x run in _t_r_a_c_e mode.  It will generate a  lot
  171.           of  messages to _s_t_d_e_r_r concerning the form of the input
  172.           and the resultant non-deterministic  and  deterministic
  173.           finite  automata.   This  option  is  mostly for use in
  174.           maintaining _f_l_e_x.
  175.  
  176.      ----VVVV    prints the version number to _s_t_d_e_r_r and exits.
  177.  
  178.      ----7777    instructs _f_l_e_x to generate a 7-bit scanner, which  can
  179.           save  considerable table space, especially when using ----
  180.           CCCCffff or ----CCCCFFFF (and, at most sites, ----7777 is on by default  for
  181.           these  options.  To see if this is the case, use the ----vvvv
  182.           verbose flag and check the flag summary it reports).
  183.  
  184.      ----8888    instructs _f_l_e_x to generate an 8-bit scanner.  This  is
  185.           the  default  except  for  the  ----CCCCffff and ----CCCCFFFF compression
  186.           options, for which the default is  site-dependent,  and
  187.           can be checked by inspecting the flag summary generated
  188.           by the ----vvvv option.
  189.  
  190.      ----++++    specifies that you want flex to generate a C++ scanner
  191.           class.   See  the section on Generating C++ Scanners in
  192.  
  193.  
  194.  
  195. Version 2.4        Last change: November 1993                   3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. FLEX(1)                   User Commands                   FLEX(1)
  203.  
  204.  
  205.  
  206.           _f_l_e_x_d_o_c(_1) for details.
  207.  
  208.      ----CCCC[[[[aaaaeeeeffffFFFFmmmmrrrr]]]]
  209.           controls the degree of table  compression  and  scanner
  210.           optimization.
  211.  
  212.           ----CCCCaaaa trade off larger tables in  the  generated  scanner
  213.           for  faster  performance  because  the  elements of the
  214.           tables are better aligned for memory access and  compu-
  215.           tation.   This option can double the size of the tables
  216.           used by your scanner.
  217.  
  218.           ----CCCCeeee directs  _f_l_e_x  to  construct  _e_q_u_i_v_a_l_e_n_c_e  _c_l_a_s_s_e_s,
  219.           i.e.,  sets  of characters which have identical lexical
  220.           properties.  Equivalence classes usually give  dramatic
  221.           reductions  in the final table/object file sizes (typi-
  222.           cally  a  factor  of  2-5)   and   are   pretty   cheap
  223.           performance-wise   (one  array  look-up  per  character
  224.           scanned).
  225.  
  226.           ----CCCCffff specifies that the _f_u_l_l scanner  tables  should  be
  227.           generated - _f_l_e_x should not compress the tables by tak-
  228.           ing advantages of similar transition functions for dif-
  229.           ferent states.
  230.  
  231.           ----CCCCFFFF specifies that the alternate fast scanner represen-
  232.           tation  (described in fffflllleeeexxxxddddoooocccc((((1111)))))))) should be used.  This
  233.           option cannot be used with ----++++....
  234.  
  235.           ----CCCCmmmm directs _f_l_e_x to construct _m_e_t_a-_e_q_u_i_v_a_l_e_n_c_e _c_l_a_s_s_e_s,
  236.           which  are  sets of equivalence classes (or characters,
  237.           if equivalence classes are not  being  used)  that  are
  238.           commonly  used  together.  Meta-equivalence classes are
  239.           often a big win when using compressed tables, but  they
  240.           have  a  moderate  performance  impact (one or two "if"
  241.           tests and one array look-up per character scanned).
  242.  
  243.           ----CCCCrrrr causes the generated scanner to _b_y_p_a_s_s using  stdio
  244.           for  input.   In general this option results in a minor
  245.           performance gain only worthwhile if used in conjunction
  246.           with   ---- CCCCffff or ----CCCCFFFF.... It can cause surprising behavior if
  247.           you use stdio yourself to read from _y_y_i_n prior to  cal-
  248.           ling the scanner.
  249.  
  250.           A lone ----CCCC specifies that the scanner tables  should  be
  251.           compressed  but  neither  equivalence classes nor meta-
  252.           equivalence classes should be used.
  253.  
  254.           The options ----CCCCffff or ----CCCCFFFF and   ---- CCCCmmmm  do  not  make  sense
  255.           together - there is no opportunity for meta-equivalence
  256.           classes if the table is not being  compressed.   Other-
  257.           wise the options may be freely mixed.
  258.  
  259.  
  260.  
  261. Version 2.4        Last change: November 1993                   4
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. FLEX(1)                   User Commands                   FLEX(1)
  269.  
  270.  
  271.  
  272.           The default setting is ----CCCCeeeemmmm,,,, which specifies that  _f_l_e_x
  273.           should   generate   equivalence   classes   and   meta-
  274.           equivalence classes.  This setting provides the highest
  275.           degree   of  table  compression.   You  can  trade  off
  276.           faster-executing scanners at the cost of larger  tables
  277.           with the following generally being true:
  278.  
  279.               slowest & smallest
  280.                     -Cem
  281.                     -Cm
  282.                     -Ce
  283.                     -C
  284.                     -C{f,F}e
  285.                     -C{f,F}
  286.                     -C{f,F}a
  287.               fastest & largest
  288.  
  289.  
  290.           ----CCCC options are cumulative.
  291.  
  292.      ----PPPPpppprrrreeeeffffiiiixxxx
  293.           changes the default _y_y prefix used by _f_l_e_x to be _p_r_e_f_i_x
  294.           instead.   See  _f_l_e_x_d_o_c(_1) for a description of all the
  295.           global variables and file names that this affects.
  296.  
  297.      ----SSSSsssskkkkeeeelllleeeettttoooonnnn____ffffiiiilllleeee
  298.           overrides the default skeleton  file  from  which  _f_l_e_x
  299.           constructs its scanners.  You'll never need this option
  300.           unless you are doing _f_l_e_x maintenance or development.
  301.  
  302. SSSSUUUUMMMMMMMMAAAARRRRYYYY OOOOFFFF FFFFLLLLEEEEXXXX RRRREEEEGGGGUUUULLLLAAAARRRR EEEEXXXXPPPPRRRREEEESSSSSSSSIIIIOOOONNNNSSSS
  303.      The patterns in the input are written using an extended  set
  304.      of regular expressions.  These are:
  305.  
  306.          x          match the character 'x'
  307.          .          any character except newline
  308.          [xyz]      a "character class"; in this case, the pattern
  309.                       matches either an 'x', a 'y', or a 'z'
  310.          [abj-oZ]   a "character class" with a range in it; matches
  311.                       an 'a', a 'b', any letter from 'j' through 'o',
  312.                       or a 'Z'
  313.          [^A-Z]     a "negated character class", i.e., any character
  314.                       but those in the class.  In this case, any
  315.                       character EXCEPT an uppercase letter.
  316.          [^A-Z\n]   any character EXCEPT an uppercase letter or
  317.                       a newline
  318.          r*         zero or more r's, where r is any regular expression
  319.          r+         one or more r's
  320.          r?         zero or one r's (that is, "an optional r")
  321.          r{2,5}     anywhere from two to five r's
  322.          r{2,}      two or more r's
  323.          r{4}       exactly 4 r's
  324.  
  325.  
  326.  
  327. Version 2.4        Last change: November 1993                   5
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. FLEX(1)                   User Commands                   FLEX(1)
  335.  
  336.  
  337.  
  338.          {name}     the expansion of the "name" definition
  339.                     (see above)
  340.          "[xyz]\"foo"
  341.                     the literal string: [xyz]"foo
  342.          \X         if X is an 'a', 'b', 'f', 'n', 'r', 't', or 'v',
  343.                       then the ANSI-C interpretation of \x.
  344.                       Otherwise, a literal 'X' (used to escape
  345.                       operators such as '*')
  346.          \123       the character with octal value 123
  347.          \x2a       the character with hexadecimal value 2a
  348.          (r)        match an r; parentheses are used to override
  349.                       precedence (see below)
  350.  
  351.  
  352.          rs         the regular expression r followed by the
  353.                       regular expression s; called "concatenation"
  354.  
  355.  
  356.          r|s        either an r or an s
  357.  
  358.  
  359.          r/s        an r but only if it is followed by an s.  The
  360.                       s is not part of the matched text.  This type
  361.                       of pattern is called as "trailing context".
  362.          ^r         an r, but only at the beginning of a line
  363.          r$         an r, but only at the end of a line.  Equivalent
  364.                       to "r/\n".
  365.  
  366.  
  367.          <s>r       an r, but only in start condition s (see
  368.                     below for discussion of start conditions)
  369.          <s1,s2,s3>r
  370.                     same, but in any of start conditions s1,
  371.                     s2, or s3
  372.          <*>r       an r in any start condition, even an exclusive one.
  373.  
  374.  
  375.          <<EOF>>    an end-of-file
  376.          <s1,s2><<EOF>>
  377.                     an end-of-file when in start condition s1 or s2
  378.  
  379.      The regular expressions listed above are  grouped  according
  380.      to  precedence, from highest precedence at the top to lowest
  381.      at the bottom.   Those  grouped  together  have  equal  pre-
  382.      cedence.
  383.  
  384.      Some notes on patterns:
  385.  
  386.      -    Negated character classes _m_a_t_c_h  _n_e_w_l_i_n_e_s  unless  "\n"
  387.           (or  an equivalent escape sequence) is one of the char-
  388.           acters explicitly  present  in  the  negated  character
  389.           class (e.g., "[^A-Z\n]").
  390.  
  391.  
  392.  
  393. Version 2.4        Last change: November 1993                   6
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. FLEX(1)                   User Commands                   FLEX(1)
  401.  
  402.  
  403.  
  404.      -    A rule can have at most one instance of  trailing  con-
  405.           text (the '/' operator or the '$' operator).  The start
  406.           condition, '^', and "<<EOF>>" patterns can  only  occur
  407.           at the beginning of a pattern, and, as well as with '/'
  408.           and '$', cannot be  grouped  inside  parentheses.   The
  409.           following are all illegal:
  410.  
  411.               foo/bar$
  412.               foo|(bar$)
  413.               foo|^bar
  414.               <sc1>foo<sc2>bar
  415.  
  416.  
  417. SSSSUUUUMMMMMMMMAAAARRRRYYYY OOOOFFFF SSSSPPPPEEEECCCCIIIIAAAALLLL AAAACCCCTTTTIIIIOOOONNNNSSSS
  418.      In addition to arbitrary C code, the following can appear in
  419.      actions:
  420.  
  421.      -    EEEECCCCHHHHOOOO copies yytext to the scanner's output.
  422.  
  423.      -    BBBBEEEEGGGGIIIINNNN followed by the name of a start condition  places
  424.           the scanner in the corresponding start condition.
  425.  
  426.      -    RRRREEEEJJJJEEEECCCCTTTT directs the scanner to proceed on to the "second
  427.           best"  rule which matched the input (or a prefix of the
  428.           input).  yyyyyyyytttteeeexxxxtttt and yyyyyyyylllleeeennnngggg are  set  up  appropriately.
  429.           Note that RRRREEEEJJJJEEEECCCCTTTT is a particularly expensive feature in
  430.           terms scanner performance; if it is used in _a_n_y of  the
  431.           scanner's   actions  it  will  slow  down  _a_l_l  of  the
  432.           scanner's matching.  Furthermore, RRRREEEEJJJJEEEECCCCTTTT cannot be used
  433.           with the ----ffff or ----FFFF options.
  434.  
  435.           Note also that unlike the other special actions, RRRREEEEJJJJEEEECCCCTTTT
  436.           is  a  _b_r_a_n_c_h;  code  immediately  following  it in the
  437.           action will _n_o_t be executed.
  438.  
  439.      -    yyyyyyyymmmmoooorrrreeee(((()))) tells  the  scanner  that  the  next  time  it
  440.           matches  a  rule,  the  corresponding  token  should be
  441.           _a_p_p_e_n_d_e_d onto the current value of yyyyyyyytttteeeexxxxtttt  rather  than
  442.           replacing it.
  443.  
  444.      -    yyyyyyyylllleeeessssssss((((nnnn)))) returns all but the first _n characters of the
  445.           current token back to the input stream, where they will
  446.           be rescanned when the scanner looks for the next match.
  447.           yyyyyyyytttteeeexxxxtttt  and  yyyyyyyylllleeeennnngggg  are  adjusted appropriately (e.g.,
  448.           yyyyyyyylllleeeennnngggg will now be equal to _n ).
  449.  
  450.      -    uuuunnnnppppuuuutttt((((cccc)))) puts the  character  _c  back  onto  the  input
  451.           stream.  It will be the next character scanned.
  452.  
  453.      -    iiiinnnnppppuuuutttt(((()))) reads the next character from the input  stream
  454.           (this  routine  is  called  yyyyyyyyiiiinnnnppppuuuutttt(((()))) if the scanner is
  455.           compiled using CCCC++++++++))))....
  456.  
  457.  
  458.  
  459. Version 2.4        Last change: November 1993                   7
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. FLEX(1)                   User Commands                   FLEX(1)
  467.  
  468.  
  469.  
  470.      -    yyyyyyyytttteeeerrrrmmmmiiiinnnnaaaatttteeee(((()))) can be used in lieu of a return statement
  471.           in  an action.  It terminates the scanner and returns a
  472.           0 to the scanner's caller, indicating "all done".
  473.  
  474.           By default, yyyyyyyytttteeeerrrrmmmmiiiinnnnaaaatttteeee(((()))) is also called when  an  end-
  475.           of-file is encountered.  It is a macro and may be rede-
  476.           fined.
  477.  
  478.      -    YYYYYYYY____NNNNEEEEWWWW____FFFFIIIILLLLEEEE is an  action  available  only  in  <<EOF>>
  479.           rules.   It  means "Okay, I've set up a new input file,
  480.           continue scanning".  It is no longer required; you  can
  481.           just  assign _y_y_i_n to point to a new file in the <<EOF>>
  482.           action.
  483.  
  484.      -    yyyyyyyy____ccccrrrreeeeaaaatttteeee____bbbbuuuuffffffffeeeerrrr(((( ffffiiiilllleeee,,,, ssssiiiizzzzeeee )))) takes a _F_I_L_E pointer and
  485.           an integer _s_i_z_e. It returns a YY_BUFFER_STATE handle to
  486.           a new input buffer  large  enough  to  accomodate  _s_i_z_e
  487.           characters and associated with the given file.  When in
  488.           doubt, use YYYYYYYY____BBBBUUUUFFFF____SSSSIIIIZZZZEEEE for the size.
  489.  
  490.      -    yyyyyyyy____sssswwwwiiiittttcccchhhh____ttttoooo____bbbbuuuuffffffffeeeerrrr((((   nnnneeeewwww____bbbbuuuuffffffffeeeerrrr   ))))   switches    the
  491.           scanner's  processing to scan for tokens from the given
  492.           buffer, which must be a YY_BUFFER_STATE.
  493.  
  494.      -    yyyyyyyy____ddddeeeelllleeeetttteeee____bbbbuuuuffffffffeeeerrrr(((( bbbbuuuuffffffffeeeerrrr )))) deletes the given buffer.
  495.  
  496. VVVVAAAALLLLUUUUEEEESSSS AAAAVVVVAAAAIIIILLLLAAAABBBBLLLLEEEE TTTTOOOO TTTTHHHHEEEE UUUUSSSSEEEERRRR
  497.      -    cccchhhhaaaarrrr ****yyyyyyyytttteeeexxxxtttt holds the text of the current  token.   It
  498.           may  be  modified but not lengthened (you cannot append
  499.           characters to the end).  Modifying the  last  character
  500.           may  affect  the  activity  of rules anchored using '^'
  501.           during the next scan; see fffflllleeeexxxxddddoooocccc((((1111)))) for details.
  502.  
  503.           If the special directive %%%%aaaarrrrrrrraaaayyyy appears  in  the  first
  504.           section  of  the  scanner  description,  then yyyyyyyytttteeeexxxxtttt is
  505.           instead declared cccchhhhaaaarrrr yyyyyyyytttteeeexxxxtttt[[[[YYYYYYYYLLLLMMMMAAAAXXXX]]]],,,, where YYYYYYYYLLLLMMMMAAAAXXXX is a
  506.           macro  definition  that  you  can redefine in the first
  507.           section if you don't like the default value  (generally
  508.           8KB).    Using   %%%%aaaarrrrrrrraaaayyyy   results  in  somewhat  slower
  509.           scanners, but the value of  yyyyyyyytttteeeexxxxtttt  becomes  immune  to
  510.           calls to _i_n_p_u_t() and _u_n_p_u_t(), which potentially destroy
  511.           its value when yyyyyyyytttteeeexxxxtttt  is  a  character  pointer.   The
  512.           opposite of %%%%aaaarrrrrrrraaaayyyy is %%%%ppppooooiiiinnnntttteeeerrrr,,,, which is the default.
  513.  
  514.           You cannot  use  %%%%aaaarrrrrrrraaaayyyy  when  generating  C++  scanner
  515.           classes (the ----++++ flag).
  516.  
  517.      -    iiiinnnntttt yyyyyyyylllleeeennnngggg holds the length of the current token.
  518.  
  519.      -    FFFFIIIILLLLEEEE ****yyyyyyyyiiiinnnn is the file  which  by  default  _f_l_e_x  reads
  520.           from.   It  may  be  redefined  but doing so only makes
  521.           sense before scanning begins or after an EOF  has  been
  522.  
  523.  
  524.  
  525. Version 2.4        Last change: November 1993                   8
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. FLEX(1)                   User Commands                   FLEX(1)
  533.  
  534.  
  535.  
  536.           encountered.  Changing it in the midst of scanning will
  537.           have unexpected results since _f_l_e_x buffers  its  input;
  538.           use  yyyyyyyyrrrreeeessssttttaaaarrrrtttt(((())))  instead.   Once  scanning  terminates
  539.           because an end-of-file has been seen,  yyyyoooouuuu  ccccaaaannnn  aaaassssssssiiiiggggnnnn
  540.           _y_y_i_n  at  the  new input file and then call the scanner
  541.           again to continue scanning.
  542.  
  543.      -    vvvvooooiiiidddd yyyyyyyyrrrreeeessssttttaaaarrrrtttt(((( FFFFIIIILLLLEEEE ****nnnneeeewwww____ffffiiiilllleeee )))) may be called to point
  544.           _y_y_i_n at the new input file.  The switch-over to the new
  545.           file is immediate (any previously buffered-up input  is
  546.           lost).   Note  that calling yyyyyyyyrrrreeeessssttttaaaarrrrtttt(((()))) with _y_y_i_n as an
  547.           argument thus throws away the current input buffer  and
  548.           continues scanning the same input file.
  549.  
  550.      -    FFFFIIIILLLLEEEE ****yyyyyyyyoooouuuutttt is the file to which EEEECCCCHHHHOOOO actions are done.
  551.           It can be reassigned by the user.
  552.  
  553.      -    YYYYYYYY____CCCCUUUURRRRRRRREEEENNNNTTTT____BBBBUUUUFFFFFFFFEEEERRRR returns a YYYYYYYY____BBBBUUUUFFFFFFFFEEEERRRR____SSSSTTTTAAAATTTTEEEE  handle  to
  554.           the current buffer.
  555.  
  556.      -    YYYYYYYY____SSSSTTTTAAAARRRRTTTT returns an integer value corresponding to  the
  557.           current start condition.  You can subsequently use this
  558.           value with BBBBEEEEGGGGIIIINNNN to return to that start condition.
  559.  
  560. MMMMAAAACCCCRRRROOOOSSSS AAAANNNNDDDD FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNNSSSS YYYYOOOOUUUU CCCCAAAANNNN RRRREEEEDDDDEEEEFFFFIIIINNNNEEEE
  561.      -    YYYYYYYY____DDDDEEEECCCCLLLL controls how the scanning routine is  declared.
  562.           By  default, it is "int yylex()", or, if prototypes are
  563.           being used, "int yylex(void)".  This definition may  be
  564.           changed  by  redefining the "YY_DECL" macro.  Note that
  565.           if you give arguments to the scanning routine  using  a
  566.           K&R-style/non-prototyped function declaration, you must
  567.           terminate the definition with a semi-colon (;).
  568.  
  569.      -    The nature of how the scanner gets  its  input  can  be
  570.           controlled    by   redefining   the   YYYYYYYY____IIIINNNNPPPPUUUUTTTT   macro.
  571.           YY_INPUT's         calling         sequence          is
  572.           "YY_INPUT(buf,result,max_size)".    Its  action  is  to
  573.           place up to _m_a_x__s_i_z_e characters in the character  array
  574.           _b_u_f  and  return  in the integer variable _r_e_s_u_l_t either
  575.           the number of characters read or the  constant  YY_NULL
  576.           (0  on  Unix  systems)  to  indicate  EOF.  The default
  577.           YY_INPUT reads from the global file-pointer "yyin".   A
  578.           sample  redefinition  of  YY_INPUT  (in the definitions
  579.           section of the input file):
  580.  
  581.               %{
  582.               #undef YY_INPUT
  583.               #define YY_INPUT(buf,result,max_size) \
  584.                   { \
  585.                   int c = getchar(); \
  586.                   result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \
  587.                   }
  588.  
  589.  
  590.  
  591. Version 2.4        Last change: November 1993                   9
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. FLEX(1)                   User Commands                   FLEX(1)
  599.  
  600.  
  601.  
  602.               %}
  603.  
  604.  
  605.      -    When the scanner  receives  an  end-of-file  indication
  606.           from  YY_INPUT,  it  then  checks the function yyyyyyyywwwwrrrraaaapppp(((())))
  607.           function.  If yyyyyyyywwwwrrrraaaapppp(((()))) returns false (zero), then it is
  608.           assumed  that  the  function  has gone ahead and set up
  609.           _y_y_i_n to point to another input file, and scanning  con-
  610.           tinues.   If  it  returns  true  (non-zero),  then  the
  611.           scanner terminates, returning 0 to its caller.
  612.  
  613.           The default yyyyyyyywwwwrrrraaaapppp(((()))) always returns 1.
  614.  
  615.      -    YY_USER_ACTION can be redefined to  provide  an  action
  616.           which  is  always  executed prior to the matched rule's
  617.           action.
  618.  
  619.      -    The macro YYYYYYYY____UUUUSSSSEEEERRRR____IIIINNNNIIIITTTT may be redefined to  provide  an
  620.           action which is always executed before the first scan.
  621.  
  622.      -    In the generated scanner, the actions are all  gathered
  623.           in  one  large  switch  statement  and  separated using
  624.           YYYYYYYY____BBBBRRRREEEEAAAAKKKK,,,, which may be redefined.  By  default,  it  is
  625.           simply  a  "break", to separate each rule's action from
  626.           the following rule's.
  627.  
  628. FFFFIIIILLLLEEEESSSS
  629.      ----llllffffllll  library with which to  link  scanners  to  obtain  the
  630.           default versions of _y_y_w_r_a_p() and/or _m_a_i_n().
  631.  
  632.      _l_e_x._y_y._c
  633.           generated scanner (called _l_e_x_y_y._c on some systems).
  634.  
  635.      _l_e_x._y_y._c_c
  636.           generated C++ scanner class, when using ----++++....
  637.  
  638.      <_F_l_e_x_L_e_x_e_r._h>
  639.           header file defining the C++ scanner base class,  FFFFlllleeeexxxx----
  640.           LLLLeeeexxxxeeeerrrr,,,, and its derived class, yyyyyyyyFFFFlllleeeexxxxLLLLeeeexxxxeeeerrrr....
  641.  
  642.      _f_l_e_x._s_k_l
  643.           skeleton scanner.  This file is only used when building
  644.           flex, not when flex executes.
  645.  
  646.      _l_e_x._b_a_c_k_u_p
  647.           backing-up information for ----bbbb flag (called  _l_e_x._b_c_k  on
  648.           some systems).
  649.  
  650. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  651.      flexdoc(1), lex(1), yacc(1), sed(1), awk(1).
  652.  
  653.  
  654.  
  655.  
  656.  
  657. Version 2.4        Last change: November 1993                  10
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664. FLEX(1)                   User Commands                   FLEX(1)
  665.  
  666.  
  667.  
  668.      M. E. Lesk and E. Schmidt, _L_E_X - _L_e_x_i_c_a_l _A_n_a_l_y_z_e_r _G_e_n_e_r_a_t_o_r
  669.  
  670. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  671.      _r_e_j_e_c_t__u_s_e_d__b_u_t__n_o_t__d_e_t_e_c_t_e_d _u_n_d_e_f_i_n_e_d or
  672.  
  673.      _y_y_m_o_r_e__u_s_e_d__b_u_t__n_o_t__d_e_t_e_c_t_e_d _u_n_d_e_f_i_n_e_d -  These  errors  can
  674.      occur  at compile time.  They indicate that the scanner uses
  675.      RRRREEEEJJJJEEEECCCCTTTT or yyyyyyyymmmmoooorrrreeee(((()))) but that _f_l_e_x failed to notice the  fact,
  676.      meaning that _f_l_e_x scanned the first two sections looking for
  677.      occurrences of these actions and failed  to  find  any,  but
  678.      somehow  you  snuck  some in (via a #include file, for exam-
  679.      ple).  Make an explicit reference to the action in your _f_l_e_x
  680.      input   file.    (Note  that  previously  _f_l_e_x  supported  a
  681.      %%%%uuuusssseeeedddd////%%%%uuuunnnnuuuusssseeeedddd mechanism for dealing with this problem;  this
  682.      feature  is  still supported but now deprecated, and will go
  683.      away soon unless the author hears from people who can  argue
  684.      compellingly that they need it.)
  685.  
  686.      _f_l_e_x _s_c_a_n_n_e_r _j_a_m_m_e_d - a scanner compiled with ----ssss has encoun-
  687.      tered  an  input  string  which wasn't matched by any of its
  688.      rules.
  689.  
  690.      _w_a_r_n_i_n_g, _r_u_l_e _c_a_n_n_o_t _b_e _m_a_t_c_h_e_d  indicates  that  the  given
  691.      rule  cannot  be matched because it follows other rules that
  692.      will always match the same text as it.  See  _f_l_e_x_d_o_c(_1)  for
  693.      an example.
  694.  
  695.      _w_a_r_n_i_n_g, ----ssss _o_p_t_i_o_n _g_i_v_e_n _b_u_t _d_e_f_a_u_l_t  _r_u_l_e  _c_a_n  _b_e  _m_a_t_c_h_e_d
  696.      means  that  it  is  possible  (perhaps only in a particular
  697.      start condition) that the default  rule  (match  any  single
  698.      character)  is  the  only  one  that will match a particular
  699.      input.  Since
  700.  
  701.      _s_c_a_n_n_e_r _i_n_p_u_t _b_u_f_f_e_r _o_v_e_r_f_l_o_w_e_d -  a  scanner  rule  matched
  702.      more text than the available dynamic memory.
  703.  
  704.      _t_o_k_e_n _t_o_o _l_a_r_g_e, _e_x_c_e_e_d_s _Y_Y_L_M_A_X - your scanner  uses  %%%%aaaarrrrrrrraaaayyyy
  705.      and one of its rules matched a string longer than the YYYYYYYYLLLLMMMMAAAAXXXX
  706.      constant (8K bytes by default).  You can increase the  value
  707.      by  #define'ing  YYYYYYYYLLLLMMMMAAAAXXXX  in  the definitions section of your
  708.      _f_l_e_x input.
  709.  
  710.      _s_c_a_n_n_e_r _r_e_q_u_i_r_e_s -_8 _f_l_a_g _t_o _u_s_e _t_h_e  _c_h_a_r_a_c_t_e_r  '_x'  -  Your
  711.      scanner specification includes recognizing the 8-bit charac-
  712.      ter '_x' and you did not  specify  the  - 8  flag,  and  your
  713.      scanner  defaulted  to 7-bit because you used the ----CCCCffff or ----CCCCFFFF
  714.      table compression options.
  715.  
  716.      _f_l_e_x _s_c_a_n_n_e_r _p_u_s_h-_b_a_c_k _o_v_e_r_f_l_o_w - you used uuuunnnnppppuuuutttt(((())))  to  push
  717.      back  so  much text that the scanner's buffer could not hold
  718.      both the pushed-back text and the current token  in  yyyyyyyytttteeeexxxxtttt....
  719.      Ideally  the scanner should dynamically resize the buffer in
  720.  
  721.  
  722.  
  723. Version 2.4        Last change: November 1993                  11
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. FLEX(1)                   User Commands                   FLEX(1)
  731.  
  732.  
  733.  
  734.      this case, but at present it does not.
  735.  
  736.      _i_n_p_u_t _b_u_f_f_e_r _o_v_e_r_f_l_o_w, _c_a_n'_t _e_n_l_a_r_g_e _b_u_f_f_e_r _b_e_c_a_u_s_e  _s_c_a_n_n_e_r
  737.      _u_s_e_s  _R_E_J_E_C_T  -  the  scanner  was  working  on  matching an
  738.      extremely large token and needed to expand the input buffer.
  739.      This doesn't work with scanners that use RRRREEEEJJJJEEEECCCCTTTT....
  740.  
  741.      _f_a_t_a_l _f_l_e_x _s_c_a_n_n_e_r _i_n_t_e_r_n_a_l _e_r_r_o_r--_e_n_d _o_f  _b_u_f_f_e_r  _m_i_s_s_e_d  -
  742.      This  can  occur  in  an  scanner which is reentered after a
  743.      long-jump has jumped out (or over) the scanner's  activation
  744.      frame.  Before reentering the scanner, use:
  745.  
  746.          yyrestart( yyin );
  747.  
  748.      or use C++ scanner classes (the ----++++ option), which are  fully
  749.      reentrant.
  750.  
  751. AAAAUUUUTTTTHHHHOOOORRRR
  752.      Vern Paxson, with the help of many ideas and  much  inspira-
  753.      tion from Van Jacobson.  Original version by Jef Poskanzer.
  754.  
  755.      See flexdoc(1) for additional credits  and  the  address  to
  756.      send comments to.
  757.  
  758. DDDDEEEEFFFFIIIICCCCIIIIEEEENNNNCCCCIIIIEEEESSSS //// BBBBUUUUGGGGSSSS
  759.      Some trailing context patterns cannot  be  properly  matched
  760.      and  generate  warning  messages  ("dangerous  trailing con-
  761.      text").  These are patterns where the ending  of  the  first
  762.      part  of  the rule matches the beginning of the second part,
  763.      such as "zx*/xy*", where the 'x*' matches  the  'x'  at  the
  764.      beginning  of  the  trailing  context.  (Note that the POSIX
  765.      draft states that the text matched by such patterns is unde-
  766.      fined.)
  767.  
  768.      For some trailing context rules, parts  which  are  actually
  769.      fixed-length  are  not  recognized  as  such, leading to the
  770.      abovementioned performance loss.  In particular, parts using
  771.      '|'   or  {n}  (such  as  "foo{3}")  are  always  considered
  772.      variable-length.
  773.  
  774.      Combining trailing context with the special '|'  action  can
  775.      result  in _f_i_x_e_d trailing context being turned into the more
  776.      expensive _v_a_r_i_a_b_l_e trailing context.  For  example,  in  the
  777.      following:
  778.  
  779.          %%
  780.          abc      |
  781.          xyz/def
  782.  
  783.  
  784.      Use of uuuunnnnppppuuuutttt(((()))) or iiiinnnnppppuuuutttt(((())))  invalidates  yytext  and  yyleng,
  785.      unless the %%%%aaaarrrrrrrraaaayyyy directive or the ----llll option has been used.
  786.  
  787.  
  788.  
  789. Version 2.4        Last change: November 1993                  12
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796. FLEX(1)                   User Commands                   FLEX(1)
  797.  
  798.  
  799.  
  800.      Use of unput() to push back more text than was  matched  can
  801.      result  in the pushed-back text matching a beginning-of-line
  802.      ('^') rule even though it didn't come at  the  beginning  of
  803.      the line (though this is rare!).
  804.  
  805.      Pattern-matching  of  NUL's  is  substantially  slower  than
  806.      matching other characters.
  807.  
  808.      Dynamic resizing of the input buffer is slow, as it  entails
  809.      rescanning  all the text matched so far by the current (gen-
  810.      erally huge) token.
  811.  
  812.      _f_l_e_x does not generate correct  #line  directives  for  code
  813.      internal  to the scanner; thus, bugs in _f_l_e_x._s_k_l yield bogus
  814.      line numbers.
  815.  
  816.      Due to both buffering of input and  read-ahead,  you  cannot
  817.      intermix  calls to <stdio.h> routines, such as, for example,
  818.      ggggeeeettttcccchhhhaaaarrrr(((()))),,,, with _f_l_e_x rules and  expect  it  to  work.   Call
  819.      iiiinnnnppppuuuutttt(((()))) instead.
  820.  
  821.      The total table entries listed by the ----vvvv flag  excludes  the
  822.      number  of  table  entries needed to determine what rule has
  823.      been matched.  The number of entries is equal to the  number
  824.      of  DFA states if the scanner does not use RRRREEEEJJJJEEEECCCCTTTT,,,, and some-
  825.      what greater than the number of states if it does.
  826.  
  827.      RRRREEEEJJJJEEEECCCCTTTT cannot be used with the ----ffff or ----FFFF options.
  828.  
  829.      The _f_l_e_x internal algorithms need documentation.
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855. Version 2.4        Last change: November 1993                  13
  856.  
  857.  
  858.  
  859.